package com.pomelo.tiku.utils;

import android.util.Log;
import android.view.View;

import java.util.Calendar;

/**
 * @author liuxiangwang
 * @date .
 */
public class ClickUtils {

    static final int NO_DOUBLE_CLICK_TIME = 1000;

    /**
     * 检查重复点击
     *
     * @param v
     * @return
     */
    public static boolean isDoubleClick(View v) {

        Object tag = v.getTag(v.getId());

        long beforeTimemiles = tag != null ? (long) tag : 0;

        long timeInMillis = Calendar.getInstance().getTimeInMillis();

        v.setTag(v.getId(), timeInMillis);

        return timeInMillis - beforeTimemiles < NO_DOUBLE_CLICK_TIME;

    }

}
